package com.hdyg.sixg.adapter;

import android.support.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hdyg.sixg.R;
import com.hdyg.sixg.entry.SmartWalletBean;
import java.util.List;

/**
 * @author CZB
 * @describe 智能钱包适配器
 * @time 2019/3/20 14:22
 */
public class SmartWalletAdapter extends BaseQuickAdapter<SmartWalletBean.ListBean, BaseViewHolder> {
    public SmartWalletAdapter(int layoutResId, @Nullable List<SmartWalletBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SmartWalletBean.ListBean item) {
        helper.setText(R.id.tv_status,item.getStatus());
        helper.setText(R.id.tv_say,item.getDesc());
        helper.setText(R.id.tv_number,item.getAmount());
        helper.setText(R.id.tv_red,item.getFh_get());
        helper.setText(R.id.tv_start,item.getCreated_at());
        helper.setText(R.id.tv_end,item.getFinish_time());
        if ("1".equals(item.getState())){
            //结束
            helper.setTextColor(R.id.tv_status,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_status_des,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_say,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_say_des,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_number,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_number_des,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_red,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_red_des,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_start,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_start_des,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_end,mContext.getResources().getColor(R.color.gray_80));
            helper.setTextColor(R.id.tv_end_des,mContext.getResources().getColor(R.color.gray_80));
        }else {
            //进行中
            helper.setTextColor(R.id.tv_status,mContext.getResources().getColor(R.color.main_color));
            helper.setTextColor(R.id.tv_status_des,mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_say,mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_say_des,mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_number,mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_number_des,mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_red,mContext.getResources().getColor(R.color.main_color));
            helper.setTextColor(R.id.tv_red_des,mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_start,mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_start_des,mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_end,mContext.getResources().getColor(R.color.white));
            helper.setTextColor(R.id.tv_end_des,mContext.getResources().getColor(R.color.white));
        }
    }
}
